package com.itheima;

import com.itheima.config.SpringConfig;
import com.itheima.service.Service;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
    /*    //通过spring的配置文件加载获得ioc容器
        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        //通过类的.class对象来获取对应的代理实现类对象
        Service service = context.getBean(Service.class);
        //通过实现类对象调用方法
        service.find();*/

        //通过spring的配置文件加载获得ioc容器
//        ApplicationContext context = new ClassPathXmlApplicationContext("Spring.xml");
        //通过类的.class对象来获取对应的代理实现类对象
//        Service service = context.getBean(Service.class);

        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
        Service service = context.getBean(Service.class);
        int num = service.createNum(100);
        System.out.println(num);
    }
}
